<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增公告')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-notices-add">
        <div class="form-group">
        <label class="col-sm-3 control-label">下拉框：</label>
        <div class="col-sm-9">
            <select class="form-control"  name="typeId" id="typeId">
                <option th:each="noticeType,staus:${list}" th:text="${noticeType.typeName}" th:value="${noticeType.typeId}"></option>
            </select>
        </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">公告主题：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="noticeName" id="noticeName" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">公告内容：</label>
            <div class="col-sm-8">
                <textarea id="noticeContent" name="noticeContent" class="form-control"></textarea>
            </div>
        </div>
        <div class="form-group">
        <label class="col-sm-3 control-label">生效时间：</label>
        <div class="col-sm-5">
            <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>

                <input type="date" class="form-control" id="noticeStarttime" name="noticeStarttime">
            </div>
        </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">失效时间：</label>
            <div class="col-sm-5">
                <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>

                    <input type="date" class="form-control" id="noticeEndtime" name="noticeEndtime">
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "notice/manager";

    // $("#form-noticeType-add").validate({
    //     onkeyup: false,
    //     rules:{
    //         typeName:{
    //             remote: {
    //                 url: ctx + "notice/type/checkNoticeTypeNameUnique",
    //                 type: "post",
    //                 dataType: "json",
    //                 data: {
    //                     "typeName" : function() {
    //                         return $.common.trim($("#typeName").val());
    //                     }
    //                 },
    //                 dataFilter: function(data, type) {
    //                     return $.validate.unique(data);
    //                 }
    //             }
    //         },
    // postCode:{
    //     remote: {
    //         url: ctx + "system/post/checkPostCodeUnique",
    //         type: "post",
    //         dataType: "json",
    //         data: {
    //             "postCode" : function() {
    //                 return $.common.trim($("#postCode").val());
    //             }
    //         },
    //         dataFilter: function(data, type) {
    //             return $.validate.unique(data);
    //         }
    //     }
    // },
    // postSort:{
    //     digits:true
    // },
    //     },
    //     messages: {
    //         // "postCode": {
    //         //     remote: "岗位编码已经存在"
    //         // },
    //         "typeName": {
    //             remote: "公告类型名称已经存在"
    //         }
    //     },
    //     focusCleanup: true
    // });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-notices-add').serialize());
        }
    }
</script>
</body>
</html>
